/*
Sader engine framework
(c) Rachel J. Morris
MIT License
www.moosader.com
*/

#include "ManagerState.h"

namespace sader
{
    void ManagerState::Init()
    {
    }

    void ManagerState::InitStates()
    {
        for ( std::vector<State*>::iterator state = m_items.begin();
                    state != m_items.end();
                    ++state )
        {
            (*state)->Init();
        }
    }

    void ManagerState::SetActiveState( int state )
    {
		m_activeStateIndex = state;
    }

    void ManagerState::Cleanup()
    {
    }

    int ManagerState::AddState( State* newState )
    {
        newState->SetWindow( m_app );
        m_items.push_back( newState );

        // Return state index
        return m_items.size() - 1;
    }

    void ManagerState::SetRenderWindow( sader::Window* app )
    {
        m_app = app;
    }

    int ManagerState::MainLoop()
    {
        return m_items[ m_activeStateIndex ]->MainLoop();
    }
}


